package io.cici.cc.mybatis.plus.core.tagHandler;

import io.cici.cc.mybatis.lite.sql_source.scripting.tag.BindTag;
import io.cici.cc.mybatis.lite.sql_source.scripting.tag.Tag;
import io.cici.cc.mybatis.plus.core.MybatisXMLScriptBuilder;

import java.util.List;

public class BindHandler implements TagHandler {
    public BindHandler() {
        // Prevent Synthetic Access
    }

    @Override
    public void handleNode(io.cici.cc.mybatis.lite.parse.Node nodeToHandle, List<Tag> targetTagList) {
        final String name = MybatisXMLScriptBuilder.cacheStr(nodeToHandle.getStringAttribute("name"));
        final String expression = MybatisXMLScriptBuilder.cacheStr(nodeToHandle.getStringAttribute("value"));
        final BindTag bindNode = new BindTag(name, expression);
        targetTagList.add(bindNode);
    }
}
